package com.dk.mq;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dk.pojo.TAuctionOrder;
import com.dk.service.ITAuctionOrderService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.sound.midi.Soundbank;

@RocketMQMessageListener(consumerGroup = "auction_order",topic = "auctionOrder")
@Component
public class AuctionOrderMQ implements RocketMQListener<TAuctionOrder> {

    @Autowired
    private ITAuctionOrderService orderService;

    //修改秒杀订单状态
    @Override
    public void onMessage(TAuctionOrder order) {
        TAuctionOrder auctionOrder = orderService.getById(order.getId());

        if ("2".equals(auctionOrder.getStatus())){
            orderService.removeById(order.getId());
        }
        System.out.println("5分钟后------");
    }
}
